import { _decorator, Color, Component, Label, Node, tween, v3, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('TextTip')
export class TextTip extends Component {
    @property(Label)
    label:Label
    start() {
        
    }

    setData(text:string, color:Color, pos:Vec3){
        this.node.worldPosition = pos
        this.label.string = text
        this.label.color = color

        let p = this.node.position

        tween(this.node)
        .to(1, { position:  v3(p.x, p.y + 60, p.z) },{
            onComplete: (target?: object) => {    
                this.node.destroy()
            }
        })
        .start()
    }
}


